//
//  LTFBeautyCollectionViewCell.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/27.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFBeautyCollectionViewCell.h"
#import "LTFBeautyView.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@interface LTFBeautyCollectionViewCell ()
<
 LTFBeautyViewDelegate
>
@property (nonatomic, retain) LTFBeautyView *beautyView;
@end

@implementation LTFBeautyCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.beautyView = [[LTFBeautyView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT - 50 -64)];
    [self.contentView addSubview:_beautyView];
    [_beautyView release];
    _beautyView.delegate = self;
    [self createData];
}
- (void)sendAddress:(NSString *)address {
    [self.delegate sendBeautyString:address];
}
- (void)setString:(NSString *)string {
    if (_string != string) {
        [_string release];
        _string = [string retain];
        [self createData];
    }
}
- (void)createData {
    _beautyView.string = self.string;
}
- (void)layoutSubviews {
    _beautyView.frame = CGRectMake(0, 0, WIDTH, HEIGHT - 50 - 64);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
